﻿package mortal.game.view.task.drama.operations
{
    import Message.DB.Tables.*;
    import flash.utils.*;
    import mortal.game.scene3D.fight.*;
    import mortal.game.view.task.drama.*;

    public class TaskDramaEffect extends Object implements ITaskDramaStepCommand
    {
        private var _callback:Function;

        public function TaskDramaEffect()
        {
            return;
        }// end function

        public function call(param1:TTaskDrama, param2:Function = null) : void
        {
            var callTimeOut:Function;
            var data:* = param1;
            var callback:* = param2;
            callTimeOut = function () : void
            {
                if (_callback != null)
                {
                    _callback.apply();
                    _callback = null;
                }
                return;
            }// end function
            ;
            this._callback = callback;
            var time:int;
            if (TaskDramaOperator.ationTime > 0)
            {
                time = TaskDramaOperator.ationTime;
            }
            if (time > 0)
            {
                setTimeout(callTimeOut, time * 1000);
            }
            else
            {
                this.callTimeOut();
            }
            SkillEffectUtil.addDramaEffect(int(data.entity));
            return;
        }// end function

        public function cancel(param1:TTaskDrama, param2:Function = null) : void
        {
            this._callback = param2;
            SkillEffectUtil.removeDramaEffect(int(param1.entity));
            if (this._callback != null)
            {
                this._callback.apply();
                this._callback = null;
            }
            return;
        }// end function

    }
}
